﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Auros.Categorisation.Umbraco
{
    public class CategoryPickerDataType : umbraco.cms.businesslogic.datatype.BaseDataType, umbraco.interfaces.IDataType
    {
        private umbraco.interfaces.IDataEditor _Editor;
        private umbraco.interfaces.IData _baseData;
        private umbraco.interfaces.IDataPrevalue _prevalueeditor;

        public override Guid Id
        {
            get
            {
                return new Guid("0b49632b-7ebc-4ea2-9280-1bccb62556d3");
            }
        }

        public override string DataTypeName
        {
            get
            {
                return "Category Picker";
            }
        }

        public override umbraco.interfaces.IDataEditor DataEditor
        {
            get
            {
                if (_Editor == null)
                    _Editor = new CategoryPicker(Data);
                return _Editor;
            }
        }

        public override umbraco.interfaces.IData Data
        {
            get
            {
                if (_baseData == null)
                    _baseData = new umbraco.cms.businesslogic.datatype.DefaultData(this);

                return _baseData;
            }
        }

        public override umbraco.interfaces.IDataPrevalue PrevalueEditor
        {
            get
            {
                if (_prevalueeditor == null)
                    _prevalueeditor = new CategoryPickerPreValueEditor(this);

                return _prevalueeditor;
            }
        }
    }
}